home *** CD-ROM | disk | FTP | other *** search
- /****************************************************************************************************
- 6/96 bob Updated #includes to support changed GX Library names.
-
- 1.0D2 ??? change transfer modes from gxXorMode to gxFastXorMode
- and change SetShapeCommonTransfer to SetShapeFastTransfer
-
- ©1990 - 1996 Apple Computer, Inc.
- All rights reserved.
- ****************************************************************************************************/
-
- #include <Types.h>
- #include <QuickDraw.h>
- #include <Fonts.h>
- #include <Windows.h>
- #include <Menus.h>
- #include <SegLoad.h>
- #include <Memory.h>
- #include <Desk.h>
-
- #include <GXGraphics.h>
- #include "GraphicsLibraries.h"
- #include <GXEnvironment.h>
-
- #include <GXTypes.h>
- #include <GXLayout.h>
- #include "LayoutLibrary.h"
-
- #include "SampleInterface.h"
-
- short MyStrLen(char *x);
- static short MyStrLen(x)
- char *x;
- {
- short c = 0;
- while (*x++) c++;
- return c;
- } /* MyStrLen */
-
- void AngledCaretsAndHilites(WindowPtr sampleWindow)
- {
- /* Variables */
- char *myString = "Intrinsically Angled Text";
- gxPoint myPoint;
- gxRunControls gxRunControls;
- gxShape caret, highlight, layout;
- short i, len, level = 0;
- gxStyle myStyle;
- gxViewPort aViewPort;
-
- /* Initialization */
-
- myPoint.x = ff(20);
- myPoint.y = ff(50);
-
- aViewPort = GXNewWindowViewPort(sampleWindow);
- SetDefaultViewPort(aViewPort);
-
- len = MyStrLen(myString);
- InitializeRunControls(&gxRunControls);
-
- myStyle = NewLayoutStyle((char *) "\pZapf Chancery Medium Italic", ff(50), 0, nil, nil, 0, nil);
-
- layout = GXNewLayout(
- 1, &len, (void *) &myString,
- 1, &len, &myStyle,
- 1, &len, &level,
- nil, &myPoint);
- GXDrawShape(layout);
-
- for (i = 0; i <= len; i++)
- {
- caret = GXGetLayoutCaret(layout, i, gxHighlightAverageAngle, gxSplitCaretType, nil);
- GXDrawShape(caret);
- GXDisposeShape(caret);
- }
-
- gxRunControls.flags = gxNoCaretAngle;
- GXSetStyleRunControls(myStyle, &gxRunControls);
- GXMoveShape(layout, 0, ff(75));
- GXDrawShape(layout);
-
- for (i = 0; i <= len; i++)
- {
- caret = GXGetLayoutCaret(layout, i, gxHighlightAverageAngle, gxSplitCaretType, nil);
- GXDrawShape(caret);
- GXDisposeShape(caret);
- }
-
- gxRunControls.flags = 0;
- GXSetStyleRunControls(myStyle, &gxRunControls);
- GXMoveShape(layout, 0, ff(75));
- GXDrawShape(layout);
-
- highlight = GXGetLayoutHighlight(layout, 5, 11, gxHighlightAverageAngle, nil);
- /* changed to make this invert */
- SetShapeFastXorTransfer(highlight, NULL, NULL);
- GXDrawShape(highlight);
- GXDisposeShape(highlight);
-
- gxRunControls.flags = gxNoCaretAngle;
- GXSetStyleRunControls(myStyle, &gxRunControls);
- GXMoveShape(layout, 0, ff(75));
- GXDrawShape(layout);
-
- highlight = GXGetLayoutHighlight(layout, 5, 11, gxHighlightAverageAngle, nil);
- /* changed to make this invert */
- SetShapeFastXorTransfer(highlight, NULL, NULL);
- GXDrawShape(highlight);
- GXDisposeShape(highlight);
-
- GXDisposeShape(layout);
- GXDisposeStyle(myStyle);
- GXDisposeViewPort(aViewPort);
- } /* main */
-